@using System.Globalization
@model SampleWebsite.Mvc3.Areas.MvcMembership.Models.UserAdministration.DetailsViewModel
@{
    ViewBag.Title = "Details";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"></script>
<h3>
    User Details: <span class="accent">@Model.DisplayName</span>
</h3>



<script type="text/javascript">
    $(function () {
        $("#tabs").tabs({ ajaxOptions: { global: false }, spinner: 'Retrieving data... <img src="/Content/Images/spinner.gif" border="0"/>' });
        $("#dialog").dialog({
            autoOpen: false,
            modal: true,
            buttons: {
                Ok: function () {
                    $(this).dialog("close");
                }
            }
        });
        $('form.ajaxable').submit(function () {
            if ($(this).valid()) {
                $.ajax({
                    url: this.action,
                    type: this.method,
                    data: $(this).serialize(),
                    success: function (result) {
                        $('#dialog').html(result);
                        $("#dialog").dialog("open");
                    }
                });
            }
            return false;
        });
    });
</script>

<div id="tabs">
    <ul>
        <li><a href="#tabs-1"><span>Details</span></a></li>
        <li><a href="#tabs-2"><span>Email Address & Comments</span></a></li>
        <li><a href="#tabs-3"><span>User Password</span></a></li>
        <li><a href="@Url.Action("DetailsWindowGUID", "Employee", new { id = (Guid)Model.User.ProviderUserKey, area="" })"><span>Employee</span></a></li>
        @*<li><a href="@Url.Action("DesignChangeSheets", "Drawing", new { id = Model.DesignChangeID })">
            <span>Changed Sheets</span></a></li>    *@
    </ul>
    <div id="tabs-1">
        @Html.Partial("_UserDetails", Model)
    </div>
    <div id="tabs-2">
        @using (Html.BeginForm("Details", "UserAdministration", new { id = Model.User.ProviderUserKey }))
        {
            <div>
                <label for="email">
                    Email Address:</label>
                @Html.TextBox("email", Model.User.Email)
            </div>
         
            <div>
                <label for="comments">
                    Comments:</label>
                @Html.TextArea("comments", Model.User.Comment)
            </div>
           
            <div>
                <input type="submit" value="Save Email Address and Comments" />
            </div>       
        }
    </div>
    
    <div id="tabs-3">
        @using (Html.BeginForm("SetPassword", "UserAdministration", new { id = Model.User.ProviderUserKey }, FormMethod.Post, new { @class = "ajaxable" }))
        {

            <fieldset>
                <p>
                    <label for="password">
                        New Password:</label>
                    @Html.TextBox("password")
                </p>
                <input type="submit" value="Change Password" />
            </fieldset>
        }
        @using (Html.BeginForm("ResetPassword", "UserAdministration", new { id = Model.User.ProviderUserKey }, FormMethod.Post, new { @class = "ajaxable" }))
        {
            <input type="submit" value="Reset to Random Password and Email User" />
        }
    </div>
</div>

<p>
    @Html.ActionLink("Back to List", "Index", null, new { @class = "btl" })
</p>

<div id="dialog" title="Result">
</div>
